package cn.nubia.admin.sysconfig.bean;

import org.apache.commons.collections.list.TreeList;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;

/**
 * Created by justin on 15/7/27.
 */
public class Module implements Comparable<Module>{

    public static Map<Integer,Module> allModules = new HashMap<>();

    public static final Integer MODULE_SOFTMANAGER = 1;

    public static final Integer MODULE_SYSTEMCONFIG = 9;

    private Integer id;

    private Integer moduleId;

    private Integer parentId;

    private Integer sort;

    private String name;

    private String tag;

    private String link;

    private ArrayList<Module> subModules;

    static{
        Module categoryModule = new Module(99,9,0,9,"分类管理","categoryFlag","${ctx}/admin/category/list.html");

    }

    public Module(Integer id, Integer moduleId, Integer parentId, Integer sort, String name, String tag, String link) {
        this.id = id;
        this.moduleId = moduleId;
        this.parentId = parentId;
        this.sort = sort;
        this.name = name;
        this.tag = tag;
        this.link = link;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public Integer getModuleId() {
        return moduleId;
    }

    public void setModuleId(Integer moduleId) {
        this.moduleId = moduleId;
    }

    public Integer getParentId() {
        return parentId;
    }

    public void setParentId(Integer parentId) {
        this.parentId = parentId;
    }

    public Integer getSort() {
        return sort;
    }

    public void setSort(Integer sort) {
        this.sort = sort;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getTag() {
        return tag;
    }

    public void setTag(String tag) {
        this.tag = tag;
    }

    public String getLink() {
        return link;
    }

    public void setLink(String link) {
        this.link = link;
    }

    @Override
    public int compareTo(Module o) {
        if(o.sort>this.sort)return -1;
        if(o.sort<this.sort)return 1;
        return 0;
    }
}
